﻿#ifndef PST_THREEDSURFACEPLOTSETTINGDATA_H
#define PST_THREEDSURFACEPLOTSETTINGDATA_H

#include <QObject>
#include <QColor>
#include <QDomNodeList>
#include <QDomElement>
#include <QDomText>
#include <QDomAttr>

namespace pst
{
    class ScalarBarSettingData;

    //class TDSPScalarBarSettingData : public QObject
    //{
    //public:
    //    TDSPScalarBarSettingData(QObject* parent = nullptr);

    //public:
    //    //====ScalarBarSettingData====//
    //    void setScalarBarFontSize(int fontSize);
    //    int getScalarBarFontSize() const;

    //    void setScalarBarMaxValue(double maxValue);
    //    double getScalarBarMaxValue() const;

    //    void setScalarBarMinValue(double minValue);
    //    double getScalarBarMinValue() const;

    //    void setScalarBarAutoRange(bool isAutoRange);
    //    bool getScalarBarAutoRange() const;

    //    void setScalarBarIsShowTitle(bool isShowTitle);
    //    bool getScalarBarIsShowTitle() const;

    //    void setScalarBarTitleColor(QColor titleColor);
    //    QColor getScalarBarTitleColor() const;

    //    void setScalarBarFontFamily(QString fontFamily);
    //    QString getScalarBarFontFamily() const;

    //    void setScalarBarTitle(QString title);
    //    QString getScalarBarTitle() const;

    //    void setScalarBarOriginalMinRange(double minValue);
    //    double getScalarBarOriginalMinRange() const;

    //    void setScalarBarOriginalMaxRange(double maxValue);
    //    double getScalarBarOriginalMaxRange() const;
    //private:
    //    int m_fontSize = 20;
    //    double m_maxValue = 1.0;
    //    double m_minValue = 0.0;
    //    bool m_isUseScalarBarAutoRange = true;
    //    bool m_isShowTitle = true;
    //    QColor m_titleColor = Qt::white;
    //    QString m_fontFamily = "宋体";
    //    QString m_title = "";

    //    double m_scalarBarMinValueOriginal = 0.0;
    //    double m_scalarBarMaxValueOriginal = 1.0;
    //};

    class TDSPGeometrySettingData : public QObject
    {
        Q_OBJECT
    public:
        TDSPGeometrySettingData(QObject* parent = nullptr);
    public:
        //====TDSPGeometrySettingData====//
        void setGeometryTransparency(int transparency);
        int getGeometryTransparency() const;
        /// @brief 文件写出至工程文件
        QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* element, bool isdiso = false);
        /// @brief 从工程文件读入数据
        void readFromProjectFile(QDomElement* element, bool isdiso = false);

    private:
        int m_transparency = 0;
    };

    class TDSPResultDataSettingData : public QObject
    {
    public:
        TDSPResultDataSettingData(QObject* parent = nullptr);
    public:
        //====resultDataSettingData====//
        void setResultDataName(QString resultName);
        QString getResultDataName() const;

        void setResultDataTransparency(int transparency);
        int getResultDataTransparency() const;

        void setResultDataScaleFactor(double scaleFactor);
        double getResultDataScaleFactor() const;
        /// @brief 文件写出至工程文件
        QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* element, bool isdiso = false);
        /// @brief 从工程文件读入数据
        void readFromProjectFile(QDomElement* element, bool isdiso = false);

    private:
        QString m_resultName = "";
        int m_transparency = 0;
        double m_scaleFactor = 1.0;
    };

    class TDSPCubeAxesActorSettingData : public QObject
    {
        Q_OBJECT
    public:
        TDSPCubeAxesActorSettingData(QObject* parent = nullptr);

    public:
        void setVisibility(bool isVis);
        bool getVisibility() const;

        /// @brief 文件写出至工程文件
        QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* element, bool isFormWindow, bool isdiso = false);
        /// @brief 从工程文件读入数据
        void readFromProjectFile(QDomElement* element, bool isFormWindow, bool isdiso = false);

    private:
        bool m_isVisibility = false;
    };

    class ThreeDSurfacePlotSettingData : public QObject
    {
        Q_OBJECT

    public:
        ThreeDSurfacePlotSettingData(QObject* parent, int id);
        ~ThreeDSurfacePlotSettingData();

        int getID() const;

        void setScalarBarSettingData(ScalarBarSettingData* scalarBarSettingData);
        ScalarBarSettingData* getScalarBarSettingData() const;

        void setGeometrySettingData(TDSPGeometrySettingData* geometrySettingData);
        TDSPGeometrySettingData* getGeometrySettingData() const;

        void setResultDataSettingData(TDSPResultDataSettingData* resultDataSettingData);
        TDSPResultDataSettingData* getResultDataSettingData() const;

        void setCubeAxesActorSettingData(TDSPCubeAxesActorSettingData* cubeAxesActorSettingData);
        TDSPCubeAxesActorSettingData* getCubeAxesActorSettingData();

        /// @brief 文件写出至工程文件
        QDomElement& writeToProjectFile(QDomDocument* doc, QDomElement* element, bool isdiso = false);
        /// @brief 从工程文件读入数据
        void readFromProjectFile(QDomElement* element, bool isdiso = false);

    private:
        int m_id = 0;
        ScalarBarSettingData* m_scalarBarSettingData;
        TDSPGeometrySettingData* m_geometrySettingData;
        TDSPResultDataSettingData* m_resultDataSettingData;
        TDSPCubeAxesActorSettingData* m_cubeAxesActorSettingData;
    };
}

#endif
